package com.lsj.config;

import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;

public class MyWebAuthenticationDetails extends WebAuthenticationDetails {

    private  boolean isPassed;

    public MyWebAuthenticationDetails(HttpServletRequest request) {
        super(request);
        String code = request.getParameter("code");
        String verify_code = (String) request.getSession().getAttribute("verify_code");
        if(!StringUtils.isEmpty(code) && !StringUtils.isEmpty(verify_code) && verify_code.equals(code)){
            isPassed = true;
        }
    }

    public boolean isPassed() {
        return isPassed;
    }

}
